import java.util.ArrayList;
import java.util.Scanner;

public class Demo {
    public static void main(String[] args) {
        System.out.println("hello world");
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        System.out.println(longestPalindrome(s));
    }
    public static String longestPalindrome(String s) {
       if(s.length()<2){
           return s;
       }
       int maxLen = 1;
       int begin = 0;
        char[] chars = s.toCharArray();
        for(int i = 0; i < chars.length-1;i++){
            for(int j =i+1;j<chars.length;j++){
                if(j-i+1 > maxLen && re(chars,i,j)){
                    maxLen = j-i+1;
                    begin = i;
                }
            }
        }
        return s.substring(begin,begin+maxLen);
    }
    public static boolean re(char[]chars,int left, int right){
        while(left<right){
            if(chars[left] != chars[right]){
                return false;
            }
            left++;
            right--;
        }
        return true;
    }
}
